// UserModel Model
const mongoose = require('../db/db')

const UserSchema = mongoose.Schema(
    {
        //          字符串类型;      必须;             唯一,不可重复
        username: {type: String, required: true, unique: true},
        password: String,
        age: Number,
        city: String,
        //          数字类型;       默认值0    0-保密  1-男  2-女
        gender: {type: Number, default: 0}
    },
    {
        timestamps: true // 时间戳,自动生成 创建/更新 时间字段
    })

const UserModel = mongoose.model('user', UserSchema)

module.exports = UserModel
